package com.stock.demo.function.home.view;

import android.content.Context;
import android.content.Intent;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;

import com.stock.demo.R;
import com.stock.demo.adapter.CourseLearningAdapter;
import com.stock.demo.framework.ui.activity.BaseNetActivity;
import com.stock.demo.model.CourseLearningBean;

import java.util.ArrayList;

public class CourseLearningListActivity extends BaseNetActivity implements CourseLearningListView {

    private RecyclerView mRvList;
    private CourseLearningAdapter mCourseLearningAdapter;

    public static void startAction(Context context) {
        Intent intent = new Intent(context, CourseLearningListActivity.class);
        context.startActivity(intent);
    }

    @Override
    public void initView() {
        ImageView ivFinish = (ImageView) findViewById(R.id.iv_course_learning_finish);
        mRvList = (RecyclerView) findViewById(R.id.rv_course_learning_list);
        ivFinish.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });
    }

    @Override
    public void initData() {
        mRvList.setLayoutManager(new LinearLayoutManager(this));
        ArrayList<CourseLearningBean> courseLearningBeen = new ArrayList<>();
        for (int i = 0; i < 10; i++) {
            courseLearningBeen.add(new CourseLearningBean());
        }
        onNetNext(courseLearningBeen).setNetComplete();
        mCourseLearningAdapter = new CourseLearningAdapter(this, courseLearningBeen);
        mRvList.setAdapter(mCourseLearningAdapter);
    }

    @Override
    public View onCreateSuccessView() {
        return LayoutInflater.from(this).inflate(R.layout.activity_course_learning, null);
    }

    @Override
    public void onReload(View v) {

    }
}
